package cn.iocoder.mall.user.biz.dao;

import cn.iocoder.mall.user.biz.dataobject.AppMessage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/***
 *@author yinxucun
 *@date 2019-12-03 17:48 
 */
@Mapper
public interface AppMessageMapper extends BaseMapper<AppMessage> {

    @Select("select * from app_message where receiver = #{id} order by id desc ")
    IPage<AppMessage> getPageListOfMessage(Page page, @Param("id") String userId);

    @Select("select * from app_message where receiver= #{userId} and id >{id} order by id desc")
    List<AppMessage> getNewMessageListById(@Param("userId")String userId,@Param("id") Long id);
}
